package thinkinjava1.ch05;

/**
 * Created by 顾博君 on 2017/2/13.
 */
class Soup {
    private Soup() {
    }

    //(1)Allow creation via static method:
    public static Soup makeSoup() {
        return new Soup();
    }

    private static Soup ps1 = new Soup();

    public static Soup access() {
        return ps1;
    }

    public void f() {
    }
}

class Sandwich {
    void f() {
        new Lunch();
    }
}

public class Lunch {
    public static void main(String[] args) {
        Soup priv1 = Soup.makeSoup();
        Sandwich f1 = new Sandwich();
        Soup.access().f();
    }
}
